<?php /*a:2:{s:41:"D:\www\long_shop\app\view\user\index.html";i:1726889831;s:42:"D:\www\long_shop\app\view\common\head.html";i:1702389678;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/jquery/jquery-1.12.4.min.js"></script>    
    <link href="/static/bst5.3.2/css/bootstrap.min.css" rel="stylesheet">
    <script src="/static/bst5.3.2/js/bootstrap.bundle.min.js"></script>
    <link rel="stylesheet" href="/static/bst-icons/font/bootstrap-icons.css">
    <script src="/static/layer/layer/layer.js"></script>
    <link rel="stylesheet" href="/static/css/my.css">    
</head>
<head>
<title>员工管理</title>

<style>
    a{text-decoration:none;}
        input{display:initial!important;}    
</style>
</head>
<body >
<div class="container-fluid">
    <form action="/index.php/user/index" method="post">
        <div class="row" id="query_bar" style="height: 50px;line-height: 50px;">
            <div class="col-4" style="text-align: left;line-height: 50px;font-size: 2rem;" >
                职员管理【<?php echo htmlentities($data['total']); ?>人】
            </div>
            <div class="col-8">
            <label for="dept_id" >部门：</label>
            <select name="dept_id" class="form-control" style="width:140px;display:initial;">
                <option value="">所有部门</option>
                <?php foreach($school as $dept): ?>
                    <option value="<?php echo htmlentities($dept['id']); ?>" <?php if($dept['id']==$dept_id): ?>selected<?php endif; ?> ><?php echo htmlentities($dept['name']); ?></option>
                <?php endforeach; ?>
            </select>

            <label for="name_or_mobile" >姓名或手机：</label>
            <input class="form-control" type="text"  id="name_or_mobile" name="name_or_mobile" value="<?php echo htmlentities($name_or_mobile); ?>" placeholder="姓名" />
            <button type="button" class="btn btn-warning query" style="vertical-align: middle;" >
                <span class="bi-search" ></span>
            </button>
            </div>
        </div>
    </form>

    <table class="table table-sm table-hover table-striped">
        <thead>
            <th>序号</th>
            <th>工号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>电话</th>
            <th style="max-width: 400px;word-break: break-word;">地址</th>
            <th>部门</th>
            <th>级别</th>
            <th>权限组</th>
            <th>照片</th>
            <th>入职日期/登记人</th>
            <th>编辑日期/编辑人</th>        
            <th>状态</th>
            <th>
                <button type="button" class="btn btn-sm btn-primary">
                    <a href="/index.php/user/user_add" alt="员工入职登记(New employee)"><span class="bi-plus-lg" style="color:white;"></span></a>
                </button>
            </th>
        </thead>
        <tbody>
            <?php foreach($data['data'] as $k=>$kv): if($kv['id']>2): ?>            
            <tr>
                <td><?php echo htmlentities($k+1); ?></td>
                <td><?php echo htmlentities($kv['uid']); ?><c style="color:red;"><?php echo htmlentities($kv['verify_str']); ?></c></td>
                <td><?php echo htmlentities($kv['name']); ?></td>
                <td><?php echo htmlentities($kv['sex']); ?></td>
                <td><?php echo htmlentities($kv['age']); ?></td>
                <td><?php echo htmlentities($kv['mobile']); ?></td>
                <td><?php echo htmlentities($kv['address']); ?></td>
                <td><?php echo htmlentities($kv['dept_id_name']); ?></td>
                <td><?php echo htmlentities($kv['level_name']); ?></td>
                <td><?php echo htmlentities($kv['group_id_name']); ?></td>
                <td><img src="<?php echo htmlentities($kv['image']); ?>" class="goods_image" style="width:40px;" alt="image lost" /></td>
                <td><?php echo htmlentities($kv['create_time']); ?><br/><?php echo htmlentities($kv['creater_name']); ?></td>
                <td><?php echo htmlentities($kv['update_time']); ?><br/><?php echo htmlentities($kv['updater_name']); ?></td>
                <td><?php echo htmlentities($kv['status_name']); ?></td>
                <td>

                    <a href="/index.php/user/edit/id/<?php echo htmlentities($kv['id']); ?>">
                        <button style="button" class="btn btn-sm btn-info"><span class="bi-pencil"></span></button>
                    </a>
                    <button type="buttun" onClick="resetPwd(<?php echo htmlentities($kv['id']); ?>)" class="btn btn-sm btn-danger"> 
                        <span class="bi-key"></span>
                    </button>
                    </a>

              
                </td>
            </tr>
            <?php endif; ?>            
            <?php endforeach; ?>

        </tbody>    
    </table>
</div>

</body>

<script type="text/javascript">

 $(function(){

    $(".query").on('click',function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2

        $("form").submit();
        layer.close(index);
    }) 

    $(".goods_image").on('click',function(){
        var img = $(this).attr('src');
        if(!img.trim()) return;

        layer.open({
          type: 1,
          title:'',
          closeBtn: 0, //不显示关闭按钮
         // anim: 1,
          time: 5*1000,
          shadeClose: true, //开启遮罩关闭              
          skin: 'layui-layer-rim', 
          content: "<img src='"+img+"' style='width:100%'>"
        });
    })    
 })

  function resetPwd(uid){
    if(!uid) return false;
      layer.confirm('是否确定重置帐号密码?', {
        btn: ['YES','CANCEL']
      }, function(){
        window.location.href="/index.php/user/resetPwd/id/"+uid;
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });    
  }

</script>


</body>
</html>
